# -*- coding: utf-8 -*-
# @Time : 2023/11/23 12:24 PM 
# @Author : Wayne
# @Email : 1
# @File : no_save.py
# @Project : young_python_demo
# @DESCRIPTION :
# 假设有一个字典

"""
可以自己判断
print(name)和break，如果获取 peter 这个人，满足条件就结束list的所有循环
不注释调 break，将 name_1 = Jack，只会打印出Peter，Jack
注释调 break，每个字典都会打印
"""
# 查询判断
name_1 = "Jack"
# 需要输出的地址
result_address = ""
list_a = [
    {
        "name": "Peter",
        "address": "shanghai"
    },
    {
        "name": "Jack",
        "address": "beijing"
    },
    {
        "name": "Jack1",
        "address": "beijing1"
    },
    {
        "name": "Jack222",
        "address": "beijing333"
    }
]

for i in list_a:
    name = i["name"]
    print(name)
    if name == name_1:
        result_address = i["address"]
        break


print(result_address)



